#include <stdio.h>
#include <string.h>
#include <errno.h>

struct S
{
    char arr[10];
    int age;
    float score;
};

int main()
{
    struct S s = {0};
    
    FILE* pf = fopen("test.txt", "rb");
    if(pf == NULL)
    {
        perror("fopen");
        return 1;
    }

    fread(&s, sizeof(struct S), 1, pf);//元素地址，元素大小，元素个数，文件流//二进制方式读//返回成功读取的元素个数
    printf("%s %d %f", s.arr, s.age, s.score);
    //关闭文件
    fclose(pf);
    pf = NULL;

    return 0;
}

